package com.example.mybatis_gennerher.mapper;

import com.example.mybatis_gennerher.model.Employee;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface EmployeeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table employee
     *
     * @mbg.generated Wed May 22 16:28:14 CST 2024
     */
    @Delete({
        "delete from employee",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table employee
     *
     * @mbg.generated Wed May 22 16:28:14 CST 2024
     */
    @Insert({
        "insert into employee (id, name, ",
        "idNo, mobile, address, ",
        "gender, salary, ",
        "birthday)",
        "values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, ",
        "#{idno,jdbcType=CHAR}, #{mobile,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ",
        "#{gender,jdbcType=INTEGER}, #{salary,jdbcType=DECIMAL}, ",
        "#{birthday,jdbcType=DATE})"
    })
    int insert(Employee row);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table employee
     *
     * @mbg.generated Wed May 22 16:28:14 CST 2024
     */
    @Select({
        "select",
        "id, name, idNo, mobile, address, gender, salary, birthday",
        "from employee",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="idNo", property="idno", jdbcType=JdbcType.CHAR),
        @Result(column="mobile", property="mobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="gender", property="gender", jdbcType=JdbcType.INTEGER),
        @Result(column="salary", property="salary", jdbcType=JdbcType.DECIMAL),
        @Result(column="birthday", property="birthday", jdbcType=JdbcType.DATE)
    })
    Employee selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table employee
     *
     * @mbg.generated Wed May 22 16:28:14 CST 2024
     */
    @Select({
        "select",
        "id, name, idNo, mobile, address, gender, salary, birthday",
        "from employee"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="idNo", property="idno", jdbcType=JdbcType.CHAR),
        @Result(column="mobile", property="mobile", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="gender", property="gender", jdbcType=JdbcType.INTEGER),
        @Result(column="salary", property="salary", jdbcType=JdbcType.DECIMAL),
        @Result(column="birthday", property="birthday", jdbcType=JdbcType.DATE)
    })
    List<Employee> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table employee
     *
     * @mbg.generated Wed May 22 16:28:14 CST 2024
     */
    @Update({
        "update employee",
        "set name = #{name,jdbcType=VARCHAR},",
          "idNo = #{idno,jdbcType=CHAR},",
          "mobile = #{mobile,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "gender = #{gender,jdbcType=INTEGER},",
          "salary = #{salary,jdbcType=DECIMAL},",
          "birthday = #{birthday,jdbcType=DATE}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Employee row);
}